#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <vector>

using namespace std;
using LL = long long;

int n;
string str;


bool check(){
    if(str.find("T") != string::npos && str.find("i") != string::npos && str.find("m") != string::npos && str.find("u") != string::npos && str.find("r") != string::npos){
        return true;
    }
    return false;
}

int main(){
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    int T;
    scanf("%d", &T);
    while(T--){
        cin >> n >> str;
        if(n != 5){
            printf("NO\n");
        }else{
            if(check()){
                printf("YES\n");
            }else{
                printf("No\n");
            }
        }

    }

    return 0;
}